Your code referenced an ODBC handle such as the hEnv, hDbc or hStmt properties that were not valid. If you used the ODBC API directly, you might have made one or more handles invalid.